<%@ page contentType="text/html;charset=GBK" %>

<%@ page import="java.util.*" %>
<%@ page import="com.ionglobal.db.*" %>
<%@ page import="com.ionglobal.lib.*" %>
<%@ page import="com.ionglobal.misc.*" %>
<%//@ page import="com.ionglobal.misc.*" %>

<%@ include file="../init_include.jsp" %>

 <%
	int pageid = 0;
	int pagerows = 10;
	int totalrows = 0;
	int totalpages = 1;
	String orderby = "id";
	String orderby2 = "asc";
	String temp = "";
	String sql = "";
	
	temp=request.getParameter("pageid");
	if( temp != null && temp.trim().length() > 0)
		pageid=Integer.parseInt(temp);

	temp=request.getParameter("orderby");
	if( temp != null && temp.trim().length() > 0)
		orderby=temp.trim();

	temp=request.getParameter("orderby2");
	if( temp != null && temp.trim().length() > 0)
		orderby2=temp.trim();
	
	temp=request.getParameter("pagerows");
	if( temp != null && temp.trim().length() > 0){
		pagerows = Integer.parseInt(temp);
		if( pagerows <=0 ) pagerows = 10;
		//session.setAttribute("pagerows",temp);
	}

	String id = "";
	String name = "";
	String ename = "";
	String parentid = "";
	String layer = "";
	String ordernum = "";


	name = request.getParameter("name");
	ename = request.getParameter("ename");
	parentid = request.getParameter("parentid");
	layer = request.getParameter("layer");
	ordernum = request.getParameter("ordernum");

 	
 	long seqid = SequenceManager.getNextValue( dbi, "sys_zone_seq" );
 	
 	sql = "insert into sys_zone( id, name,ename,parentid,layer,ordernum) values( ";
 	sql += seqid + ",";
	sql = sql + "'"+ dbi.fixSql(name) +"', ";
	sql = sql + "'"+ dbi.fixSql(ename) +"', ";
	sql = sql + parentid +", ";
	sql = sql + layer +", ";
	sql = sql + ordernum +")";
 
	dbi.execute( sql );
  	response.sendRedirect("sys_zone_list.jsp" + "?parentid=" + parentid+"&pageid="+ pageid + "&ordery=" + orderby + "&orderby2=" + orderby2+  "&pagerows=" + pagerows  );
 	
 %>

<%@ include file="../init_free.jsp" %>  